const path=require("path")
const extractTextWebpackPlugin=require("extract-text-webpack-plugin")

module.exports={
    context:path.join(__dirname,"./src") ,
    entry:"./js/main.js", 
    output:{
        path:path.join(__dirname,"./dist"),
        filename:"bundle.js",
    }, 

 
  
    module:{
        rules:[
            {
                test: /\.css$/,
                use:extractTextWebpackPlugin.extract({
                    fallback:"style-loader", 
                    use:"css-loader"
                })

            },
          
            { 
                test: /\.less$/, //识别less文件
                use: ['style-loader', 'css-loader', "less-loader"]// 解析less语法，把less转成css ,把css添加到html中
            }


        ] 


    } ,

    plugins:[
        new extractTextWebpackPlugin("./css/index.css")
    ] 




    
    // mode: 项目环境类型：生产production（上线所需环境）环境和开发development（开发代码所需）环境

}



